<%@ Control Language="C#" AutoEventWireup="true" Inherits="NopSolutions.NopCommerce.Web.Administration.Modules.MessageQueueControl"
    CodeBehind="MessageQueue.ascx.cs" %>
<%@ Register TagPrefix="nopCommerce" TagName="ToolTipLabel" Src="ToolTipLabelControl.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="NumericTextBox" Src="NumericTextBox.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="SimpleTextBox" Src="SimpleTextBox.ascx" %>
<div class="section-header">
    <div class="title">
        <img src="Common/ico-system.png" alt="System" />
        Message Queue
    </div>
    <div class="options">
        <asp:Button ID="LoadButton" runat="server" Text="Load" CssClass="adminButtonBlue"
            OnClick="LoadButton_Click" ToolTip="Load messages in queue" />
    </div>
</div>
<table width="100%" class="adminContent">
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblStartDate" Text="Start date:" ToolTip="The start date for the search in Coordinated Universal Time (UTC)."
                ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:TextBox runat="server" ID="txtStartDate" />
            <asp:ImageButton runat="Server" ID="iStartDate" ImageUrl="~/images/Calendar_scheduleHS.png"
                AlternateText="Click to show calendar" /><br />
            <ajaxToolkit:CalendarExtender ID="cStartDateButtonExtender" runat="server" TargetControlID="txtStartDate"
                PopupButtonID="iStartDate" />
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblEndDate" Text="End date:" ToolTip="The end date for the search in Coordinated Universal Time (UTC)."
                ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:TextBox runat="server" ID="txtEndDate" />
            <asp:ImageButton runat="Server" ID="iEndDate" ImageUrl="~/images/Calendar_scheduleHS.png"
                AlternateText="Click to show calendar" /><br />
            <ajaxToolkit:CalendarExtender ID="cEndDateButtonExtender" runat="server" TargetControlID="txtEndDate"
                PopupButtonID="iEndDate" />
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblFromEmail" Text="From address:" ToolTip="From address."
                ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:TextBox ID="txtFromEmail" CssClass="adminInput" runat="server"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblToEmail" Text="To address:" ToolTip="To address."
                ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:TextBox ID="txtToEmail" CssClass="adminInput" runat="server"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblLoadNotSentItemsOnly" Text="Load not sent emails only:"
                ToolTip="Only load emails into queue that have not yet been sent." ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:CheckBox ID="cbLoadNotSentItemsOnly" runat="server" Checked="true"></asp:CheckBox>
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblMaxSendTries" Text="Maximum send attempts:"
                ToolTip="The maximum number of attempts to send a message." ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" ID="txtMaxSendTries"
                RequiredErrorMessage="Enter maximum send tries" MinimumValue="0" MaximumValue="999999"
                Value="10" RangeErrorMessage="The value must be from 0 to 999999"></nopCommerce:NumericTextBox>
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblGoDirectlyToEmailNumber" Text="Go directly to email #:"
                ToolTip="Go directly to email #" ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <nopCommerce:SimpleTextBox runat="server" CssClass="adminInput" ID="txtEmailID" Width="100px"
                ValidationGroup="GoDirectly" ErrorMessage="Email number is required"></nopCommerce:SimpleTextBox>
            </asp:TextBox><asp:Button runat="server" Text="Go" CssClass="adminButtonBlue" ID="btnGoDirectlyToEmailNumber"
                OnClick="btnGoDirectlyToEmailNumber_Click" ValidationGroup="GoDirectly" ToolTip="Go directly to email #" />
        </td>
    </tr>
</table>
<p>
</p>
<asp:GridView ID="gvQueuedEmails" runat="server" AutoGenerateColumns="False" Width="100%"
    OnPageIndexChanging="gvQueuedEmails_PageIndexChanging" AllowPaging="true" PageSize="15">
    <Columns>
        <asp:BoundField DataField="QueuedEmailID" HeaderText="Queued email ID" ItemStyle-Width="12%">
        </asp:BoundField>
        <asp:BoundField DataField="Priority" HeaderText="Priority" ItemStyle-Width="5%">
        </asp:BoundField>
        <asp:TemplateField HeaderText="From" ItemStyle-Width="25%">
            <ItemTemplate>
                <%#GetFromInfo(Container.DataItem as QueuedEmail)%>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="To" ItemStyle-Width="25%">
            <ItemTemplate>
                <%#GetToInfo(Container.DataItem as QueuedEmail)%>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="View" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="10%"
            ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <a href="MessageQueueDetails.aspx?QueuedEmailID=<%#Eval("QueuedEmailID")%>">View</a>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Created on" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%"
            ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <%#DateTimeHelper.ConvertToUserTime((DateTime)Eval("CreatedOn")).ToString()%>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Sent on" ItemStyle-Width="15%">
            <ItemTemplate>
                <%#GetSentOnInfo(Container.DataItem as QueuedEmail)%>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
<br />
<asp:Label runat="server" ID="lblQueuedEmailsFound" Text="No queued emails found"
    Visible="false"></asp:Label>